class ListNode {
    ListNode next;
    int val;
    ListNode(int val) {
        this.val = val;
        next = null;
    }
}

public class code6 {
    //输出单向链表中倒数第k个结点
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            int n = Integer.parseInt(in.next());
            ListNode head = new ListNode(-1);
            ListNode tmp = head;
            for(int i=0;i<n;i++) {
                ListNode node = new ListNode(in.nextInt());
                tmp.next = node;
                tmp = tmp.next;
            }
            int k = Integer.parseInt(in.next());
            if (get(head.next,k)!=null) System.out.println(get(head.next,k).val);
            else System.out.print(0);
        }


    }
    public static ListNode get(ListNode head,int k) {
        if(k<=0) return null;
        ListNode fast = head;
        ListNode slow = head;
        int count = 0;
        while(count!=k-1) {
            if(fast.next!=null) {
                fast = fast.next;
                count++;
            } else {
                return null;
            }
        }
        while(fast.next!=null) {
            fast = fast.next;
            slow = slow.next;
        }
        return slow;
    }
}
